﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
using Cofe.Core;
using Cofe.Core.Entry;
using Cofe.Core.Filter;
using Cofe.Core.Implements;

namespace Cofe.Web
{
    /// <summary>
    /// 
    /// </summary>
    [XmlRoot(ElementName = "EntryList", Namespace = CofeConstants.Namespace)]
    public class WebEntryList : IXmlSerializable, ISerializable
    {

        //public EntryList EmbeddedContainer { get; set; }

        #region Constructor

        //public WebEntryList(SerializationInfo info, StreamingContext context)
        //{
        //    ParameterDic pd;
        //    IEnumerable<CofeSystemInfo> entries;
        //    if (!(CofeServices.EntrySerializer.ReadObjectData(info, context, out entries, out pd)))
        //        throw new ArgumentException("Failed to deserialize.");
        //    Parameters = pd;
        //    Entries = entries;
        //}

        public WebEntryList()
        {
            Parameters = new ParameterDic();
        }

        #endregion


        #region Methods

        public System.Xml.Schema.XmlSchema GetSchema()
        {
            throw new NotImplementedException();
        }

        public void ReadXml(System.Xml.XmlReader reader)
        {
            throw new NotImplementedException();
        }

        public void WriteXml(System.Xml.XmlWriter writer)
        {
            CofeServices.EntryXmlSerializer.WriteXml(this.Entries, writer, false);
        }


        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            CofeServices.EntryXmlSerializer.WriteObjectData(this.Entries, Parameters, info, context, false);
        }
        
        #endregion

        #region Data
        
        #endregion

        #region Public Properties

        public ParameterDic Parameters { get; set; }
        public IEnumerable<CofeSystemInfo> Entries { get; set; }
        
        #endregion

       
    }
}
